package com.intelligent.bot.service.sys.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.intelligent.bot.base.result.B;
import com.intelligent.bot.dao.AdConfigDao;
import com.intelligent.bot.model.AdConfig;
import com.intelligent.bot.model.DiscordAccountConfig;
import com.intelligent.bot.model.KeyNumberConfig;
import com.intelligent.bot.model.base.BasePageHelper;
import com.intelligent.bot.service.sys.AdConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author Dreams
* @description 针对表【ad_config】的数据库操作Service实现
* @createDate 2024-03-21 10:56:15
*/
@Service
public class AdConfigServiceImpl extends ServiceImpl<AdConfigDao, AdConfig>
    implements AdConfigService {

    @Resource
    AdConfigDao adConfigDao;

    @Override
    public B<Page<AdConfig>> queryPage(BasePageHelper req) {
        Page<AdConfig> page = new Page<>(req.getPageNumber(),req.getPageSize());
        return B.okBuild(adConfigDao.queryPage(page));
    }

    @Override
    public B<Void> update(AdConfig req) {
        AdConfig adConfig = BeanUtil.copyProperties(req, AdConfig.class);
        this.updateById(adConfig);
        return B.okBuild();
    }
}




